<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2017/10/22
  Time: 19:46
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="config.jsp"%>
<html>
<head>
    <title><%=webTitle%></title>
    <meta name="Keywords" content="<%=keywords%>">
    <meta name="Description" content="<%=Description%>">
    <link rel="stylesheet" href="css/style.css">
</head>
<body>
    <%

    %>
    <div align="center">
        <%@include file="component/top.jsp"%><!---顶栏-->
        <%@include file="component/checkBox.jsp"%><!--搜索框-->
        <div  style="width: 600px;text-align: center;padding: 0">
                <form method='post' action='' >
                    <p align="left" >
                        <table>
                            <tr>
                                <td><p>图书编号</p></td>
                                <td><input type=text class="box2" id="bookId" value=''></td>
                            </tr>
                            <tr>
                                <td><p>图书名称</p></td>
                                <td><input type=text class="box2" id="bookName" value=''></td>
                            </tr>
                            <tr>
                                <td><p>出版社</p></td>
                                <td><input type=text class="box2" id="press" value=''></td>
                            </tr><tr>
                            <td><p>图书封面</p></td>
                                 <td><input type=text class="box2" id="bookImg" value=''></td>
                             </tr>
                            <tr>
                                <td><p>图书介绍</p></td>
                                <td><textarea name="bookIntroduction" id="bookIntroduction" cols="60" rows="10">在这里写图书的介绍</textarea> </td>
                            </tr>
                         </table>
                       
                        <input id="tj" type="button" class="bt500x50" name='tj' value='确认无误，提交以上信息' style="margin-left: 20px;margin-top: 20px">
                    </P>
                </form>
                <script>
                    $("#tj").click(function () {
                            //获取图书信息
                            var js_bookId=$("#bookId").val();
                            var js_booName=$("#bookName").val();
                            var js_bookPress=$("#press").val();
                            var js_bookImg=$("#bookImg").val();
                            var js_bookIntroduction=$("#bookIntroduction").val();
                            //获取用户信息
//                            var js_AuthorizedIP=$.cookie('AuthorizedIP');
//                            var js_effectiveTime=$.cookie("effectiveTime");
//
//                            var js_sha1=$.cookie("sha1");
//                            var js_userid=$.cookie("userid");
                            $.post("UploadBookServlet",{ bookId:js_bookId,bookName:js_booName,press:js_bookPress,bookIntroduction:js_bookIntroduction},function (data) {
                                if(data=="success"){
                                    alert("上传图书成功。");
                                    $("#bookId").val("");
                                    $("#bookName").val("");
                                    $("#press").val("");
                                    $("#bookIntroduction").val("");
                                }else{
                                    alert(data);
                                }
                            });
                    });
                </script>
        </div>
    </div>
</body>
</html>
